﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;

namespace GUI
{
    public partial class LapBaoCaoNam : Form
    {
        public LapBaoCaoNam()
        {
            InitializeComponent();
        }

        private void LapBaoCaoNam_Load(object sender, EventArgs e)
        {
            List<int> nam = new List<int>();
            nam = BCNam_BUS.thongKeNam();
            for (int i = 0; i < nam.Count; i++)
                ComboBox_Nam.Items.Add(nam[i]);
            Button_LapBaoCao.Enabled = false;
        }

        private void Button_LapBaoCao_Click(object sender, EventArgs e)
        {
            //Lấy giá trị năm trong Combobox_Nam
            int nam = (int)ComboBox_Nam.SelectedItem;
            List<BCNam_DTO> baoCaoNam = new List<BCNam_DTO>();
            baoCaoNam = BCNam_BUS.lapBaoCaoNam(nam);
            DataGridView_BaoCaoNam.Rows.Clear();
            for (int i = 0; i < baoCaoNam.Count; i++)
                DataGridView_BaoCaoNam.Rows.Add(baoCaoNam[i].thang, baoCaoNam[i].soCB, baoCaoNam[i].doanhThu, baoCaoNam[i].tiLe);
        }

        private void ComboBox_Nam_SelectedIndexChanged(object sender, EventArgs e)
        {
            Button_LapBaoCao.Enabled = true;
        }

        private void LapBaoCaoNam_Load_1(object sender, EventArgs e)
        {

        }
    }
}
